PULISH_TIME ='2021-12-21 13-06-15'#line:1
VERSION ='v2.2.1.12'#line:2
TITLE_TYPE =False #line:3
T =False #line:4
A =True #line:5
ma =False
#from Crypto.Cipher import AES
#from hashlib import md5
import json
import time as O0000O0000Q0000 #line:6
import os as O00QQ0OO00O0 #line:7
Q00000QOOOOO00O =O0000O0000Q0000 .strftime ('%Y-%m-%d %H-%M-%S')#line:8
if O00QQ0OO00O0 .name =='nt':#line:9
    from colorama import init #line:10
    init (autoreset =True )#line:11
def printc (*O00O0O0OOOO0O0OOO ,conf =[(1 ,36 ,48 )]):#line:13
    print (''.join (['\033[%s;%s;%sm%s\033[0m'%(conf [O0O00O0OO0O00O0OO if O0O00O0OO0O00O0OO <=len (conf )-1 else len (conf )-1 ][0 ],conf [O0O00O0OO0O00O0OO if O0O00O0OO0O00O0OO <=len (conf )-1 else len (conf )-1 ][1 ],conf [O0O00O0OO0O00O0OO if O0O00O0OO0O00O0OO <=len (conf )-1 else len (conf )-1 ][2 ],O00O0O0OOOO0O0OOO [O0O00O0OO0O00O0OO ])for O0O00O0OO0O00O0OO in range (len (O00O0O0OOOO0O0OOO ))]))#line:14
OO00000OOQ000O ='╔══════════════════════════════════════╗\n'+'║  程序开始时间: %s%s║\n'%(Q00000QOOOOO00O ,((60 if TITLE_TYPE else 22 )-len (Q00000QOOOOO00O ))*' ')+'╠══════════════════════════════════════╣\n'+'║  程序版本: %s%s║\n'%(VERSION ,((64 if TITLE_TYPE else 26 )-len (VERSION ))*' ')+'╠══════════════════════════════════════╣\n'+'║  程序修改时间: %s%s║\n'%(PULISH_TIME ,((60 if TITLE_TYPE else 22 )-len (PULISH_TIME ))*' ')+'╚══════════════════════════════════════╝'#line:16
printc (OO00000OOQ000O ,conf =[(1 ,32 ,48 )])#line:17
import mitmproxy .http as mp #line:19
import re ,sys #line:20

import urllib .request as OOOQQ0000QOOOO000 #line:22
p =O00QQ0OO00O0 .getcwd ().replace ('\\','/')+'/'#line:24
if not O00QQ0OO00O0 .path .exists (p +'ark_history'):#line:25
    O00QQ0OO00O0 .makedirs (p +'ark_history')#line:26
his =p +'ark_history/'+Q00000QOOOOO00O #line:27
with open (his ,'w',encoding ='utf-8')as f :#line:28
    f .write (OO00000OOQ000O +'\n\n')#line:29
    f .close ()#line:30
try :#line:31
    f =open (p +'ark_data.json','r+',encoding ='utf-8')#line:32
    data =f .read ()#line:33
except Exception as e :#line:34
    print (e )#line:35
    f =open (p +'ark_data.json','w',encoding ='utf-8')#line:36
    data ='{}'#line:37
try :#line:38
    data =json .loads (data )#line:39
    O00OOOQ0000O0000O00OO0 =json .dumps (data ,indent =2 ,separators =(', ',': '),ensure_ascii =False )#line:40
    f .seek (0 )#line:41
    f .truncate ()#line:42
    f .write (O00OOOQ0000O0000O00OO0 )#line:43
    f .close ()#line:44
except Exception as e :#line:45
    printc ('加载ark_data.json时出错:\r\n',e ,conf =[(1 ,33 ,48 ),(1 ,31 ,48 )])#line:46
    data ={}#line:47
    O00OOOQ0000O0000O00OO0 ='{}（加载出错，已将其作为空处理）'#line:48
printc ('data文件内容:\r\n',O00OOOQ0000O0000O00OO0 ,conf =[(1 ,36 ,48 ),(1 ,33 ,48 )])#line:49
del f #line:50
del O00OOOQ0000O0000O00OO0 #line:51
try :#line:52
    O0000Q0000000QQO =json .loads (OOOQQ0000QOOOO000 .urlopen (OOOQQ0000QOOOO000 .Request ('https://gitee.com/jxr2006/ark-fatigue/raw/main/conf.dat',method ='GET')).read ())#line:53
except :#line:54
    printc ('获取配置信息失败，请检查网络',conf =[(1 ,31 ,48 )])#line:55
    sys .exit (1 )#line:56
login_time = 0
char = {}
def O00OOO00000OO00O00OO0 ():#line:58
    O0OO0O0000000O00O =O0000Q0000000QQO ['holiday_on']#line:59
    O0OO000000O0000O0 =O0000Q0000000QQO ['holiday_off']#line:60
    O0O0O0O0O000OO000 =O0000O0000Q0000 .localtime ().tm_wday #line:61
    OO0O00O00O0000000 =O0000O0000Q0000 .localtime ().tm_mon #line:62
    O0OOOO00O00OO00OO =O0000O0000Q0000 .localtime ().tm_mday #line:63
    return ma #line:65
class O00OOO00000O00OO0O0 :#line:66
    def get (OO0OOO0OO00000OO0 ):#line:67
        return O0000Q0000000QQO ['urls'][OO0OOO0OO00000OO0 ]#line:68
    def Q00OOO0OOO00000O00OO0 (OOO000O0000OOO00O ,*OO0O0OO000O00OO0O ):#line:69
        return False in (re .match (OO0000000OO00OOO0 ,OOO000O0000OOO00O )==None for OO0000000OO00OOO0 in OO0O0OO000O00OO0O )or True in (OOO00000OOOO0OOOO in OOO000O0000OOO00O for OOO00000OOOO0OOOO in OO0O0OO000O00OO0O )#line:70
class O00OOO00000OO000OO0 :#line:72
    def response (O000O00O00OOOO0OO ,O000OO00O00O000O0 :mp .HTTPFlow ):#line:73
        if not O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (O000OO00O00O000O0 .request .url ,O00OOO00000O00OO0O0 .get ('hyper_host'),O00OOO00000O00OO0O0 .get ('bili_host'),'none.com'):#line:74
            return #line:75
        O0OOOOO00000O0O0O ='\n\n\n=================='+O0000O0000Q0000 .strftime ('%Y-%m-%d %H:%M:%S')+'===============\n'#line:76
        O0OOOOO00000O0O0O +='请求url: '+O000OO00O00O000O0 .request .url +'\n'#line:77
        O0OOOOO00000O0O0O +='请求头'+str (O000OO00O00O000O0 .request .headers )+'\n'#line:78
        try :#line:79
            O0OOOOO00000O0O0O +=('请求体: '+O000OO00O00O000O0 .request .get_text ()if O000OO00O00O000O0 .request .get_text ()!=None else '')+'\n'#line:80
        except :#line:81
            O0OOOOO00000O0O0O +='请求体: '+'（decode失败或者为空）'#line:82
        O0OOOOO00000O0O0O +='状态码: '+str (O000OO00O00O000O0 .response .status_code )+'\n'#line:83
        O0OOOOO00000O0O0O +='返回头'+str (O000OO00O00O000O0 .response .headers )+'\n'#line:84
        try :#line:85
            O0OOOOO00000O0O0O +='返回体: '+O000OO00O00O000O0 .response .text if O000OO00O00O000O0 .response .text !=None else ''#line:86
        except :#line:87
            O0OOOOO00000O0O0O +='返回体: '+'（decode失败或者为空）'#line:88
        global his #line:89
        with open (his ,'a+',encoding ='utf-8')as OOOO0O0O000000OOO :#line:90
            OOOO0O0O000000OOO .write (O0OOOOO00000O0O0O )#line:91
            OOOO0O0O000000OOO .close ()#line:92
class O00OOO00000O00OO0000O0O :#line:94
    def request (O00O00O00O0O000OO ,OOO0000000OO00OO0 :mp .HTTPFlow ):#line:95
        OO0OO0OO0000OO0O0 =OOO0000000OO00OO0 .request .url #line:96
        if O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (OO0OO0OO0000OO0O0 ,O00OOO00000O00OO0O0 .get ('account_login'))and not O00OOO00000OO00O00OO0 ():#line:100
            printc ('当前为时间段外')#line:101
            O00O00OOO0O00OOO0 =[OOO00O0OO0O0O000O for OOO00O0OO0O0O000O in data if data [OOO00O0OO0O0O000O ]['uid']==int (json .loads (OOO0000000OO00OO0 .request .get_content ())['uid'])]#line:102
            OO0OO00OOO00000OO =O00O00OOO0O00OOO0 [0 ]if len (O00O00OOO0O00OOO0 )>=1 else None #line:103
            del O00O00OOO0O00OOO0 #line:104
            if OO0OO00OOO00000OO :#line:105
                OOO0000000OO00OO0 .request .host ='none.com'#line:106
                OO00OO0OOO00OOO00 =bytes (json .dumps ({'result':0 ,'uid':str (data [OO0OO00OOO00000OO ]['uid']),'secret':data [OO0OO00OOO00000OO ]['secret']if 'secret'in data [OO0OO00OOO00000OO ]else None ,'serviceLicenseVersion':0 }),encoding ='utf-8')#line:112
                OOO0000000OO00OO0 .response =mp .Response .make (status_code =200 ,content =OO00OO0OOO00OOO00 ,headers ={'Cache-Control':'no-cache','Content-Length':bytes (len (OO00OO0OOO00OOO00 )),'Content-Type':'application/json; charset=utf-8','Date':'Sat, 06 Nov 2021 13:41:52 GMT','seqnum':bytes (str (data [OO0OO00OOO00000OO ]['seqnum']),encoding ='utf-8')},)#line:123
                del OO00OO0OOO00OOO00 #line:124
                printc ('已进行返回头和返回体修改:\r\n',str (OOO0000000OO00OO0 .response .headers )+'\r\n'+OOO0000000OO00OO0 .response .text ,conf =[(1 ,36 ,48 ),(1 ,33 ,48 )])#line:125
            else :#line:126
                printc ('查找不到此账号信息，','请在法定时间内登陆一次','以获得账号信息',conf =[(1 ,36 ,48 ),(1 ,31 ,48 ),(1 ,36 ,48 )])#line:127
        elif O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (OO0OO0OO0000OO0O0 ,O00OOO00000O00OO0O0 .get ('login_out'))and not O00OOO00000OO00O00OO0 ():#line:128
            OOO0000000OO00OO0 .request .host ='none.com'#line:129
            OOO0000000OO00OO0 .response =mp .Response .make (status_code =200 ,content =b'{"result":0}',headers ={'Cache-Control':'no-cache','Content-Length':'12','Content-Type':'application/json; charset=utf-8','Date':'Sat, 06 Nov 2021 13:41:52 GMT','Vary':'origin'},)#line:140
    def response (OO000O0O0OOOOOOOO ,flow :mp .HTTPFlow ):#line:142
        global data,ma #line:143
        _url =flow .request .url #line:144
        O00O0O0O00000O0O0 =False #line:145
        if O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (_url ,O00OOO00000O00OO0O0 .get ('remote_config')):#line:146
            OO0O00000OO0OOO0O =json .loads (flow .response .content )#line:147
            OO0O00000OO0OOO0O ['enableBestHttp']=False #line:148
            flow .response .set_text (json .dumps (OO0O00000OO0OOO0O ))#line:149
            printc ('修改完remote_config')#line:150
        elif O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (_url ,O00OOO00000O00OO0O0 .get ('time_conf')):#line:151
            OO0O00000OO0OOO0O =json .loads (flow .response .content )#line:152
            OO0O00000OO0OOO0O ['recEnable']='false'#line:153
            flow .response .set_text (json .dumps (OO0O00000OO0OOO0O ))#line:154
            printc ('对time-config完成修改')#line:155
        elif O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (_url ,O00OOO00000O00OO0O0 .get ('get_token')):#line:156
            printc ('getToken包内容:\r\n',flow .response .text ,conf =[(1 ,36 ,48 ),(1 ,33 ,48 )])#line:157
            if flow .response .status_code !=200 :#line:158
                O00O000OO0000OOOO =[OO000O000O000O0OO for OO000O000O000O0OO in data if data [OO000O000O000O0OO ]['login']['access_key']==json .loads (json .loads (flow .request .get_content ())['extension'])['access_token']]#line:159
                OOO000OO0000OO0OO =O00O000OO0000OOOO [0 ]if len (O00O000OO0000OOOO )>=1 else None #line:160
                del O00O000OO0000OOOO #line:161
                ma=False
                if OOO000OO0000OO0OO and A :#line:162
                    flow .response .status_code =200 #line:163
                    OO0O00000OO0OOO0O ={'result':0 ,'error':'','uid':str (data [OOO000OO0000OO0OO ]['uid']),'channelUid':int (OOO000OO0000OO0OO ),'token':data [OOO000OO0000OO0OO ]['token'],'isGuest':0 ,'extension':'{\"nickName\":\"'+data [OOO000OO0000OO0OO ]['login']['uname']+'\"}'if json .loads (flow .request .text )['channelId']=='2'else '{\"isGuest\":false}'}#line:172
                    flow .response .set_text (json .dumps (OO0O00000OO0OOO0O ))#line:173
                    printc ('密钥获取错误，已进行返回体修改:\r\n',flow .response .text ,conf =[(1 ,36 ,48 ),(1 ,33 ,48 )])#line:174
                else :#line:175
                    printc ('查找不到此账号信息，','请在法定时间内登陆一次','以获得账号信息',conf =[(1 ,36 ,48 ),(1 ,31 ,48 ),(1 ,36 ,48 )])#line:176
            else :#line:177
                OO0O00000OO0OOO0O =json .loads (flow .response .content )#line:178
                O00O000OO0000OOOO =[O00O00O0O0000O000 for O00O00O0O0000O000 in data if int (O00O00O0O0000O000 )==OO0O00000OO0OOO0O ['channelUid']]#line:179
                OOO000OO0000OO0OO =O00O000OO0000OOOO [0 ]if len (O00O000OO0000OOOO )>=1 else None #line:180
                del O00O000OO0000OOOO #line:181
                O0O0OOOOOOOO00OO0 =json .loads (json .loads (flow .request .get_content ())['extension'])['access_token']#line:182
                if OOO000OO0000OO0OO :#line:183
                    data [OOO000OO0000OO0OO ]['login']['access_key']=O0O0OOOOOOOO00OO0 #line:184
                    data [OOO000OO0000OO0OO ]['uid']=int (OO0O00000OO0OOO0O ['uid'])#line:185
                    data [OOO000OO0000OO0OO ]['token']=OO0O00000OO0OOO0O ['token']#line:186
                    O00O0O0O00000O0O0 =True #line:187
                    printc ('正常获得token')#line:188
                    ma =True
                elif json .loads (flow .request .text )['channelId']=='1':#line:189
                    OOOOOOOO00O0O0000 =str (OO0O00000OO0OOO0O ['channelUid'])#line:190
                    if OOOOOOOO00O0O0000 in data :#line:191
                        data [OOOOOOOO00O0O0000 ]['login']['access_key']=O0O0OOOOOOOO00OO0 #line:192
                        data [OOOOOOOO00O0O0000 ]['uid']=int (OO0O00000OO0OOO0O ['uid'])#line:193
                        data [OOOOOOOO00O0O0000 ]['token']=OO0O00000OO0OOO0O ['token']#line:194
                        O00O0O0O00000O0O0 =True #line:195
                        printc ('检测到官服账号成功登陆，已同步账号信息')#line:196
                    else :#line:197
                        data [str (OO0O00000OO0OOO0O ['channelUid'])]={'login':{'access_key':O0O0OOOOOOOO00OO0 ,},'uid':int (OO0O00000OO0OOO0O ['uid']),'seqnum':'1','token':OO0O00000OO0OOO0O ['token'],}#line:205
                        O00O0O0O00000O0O0 =True #line:206
                        printc ('检测到官服新账号成功登陆，已建立账号信息')#line:207
                    del OOOOOOOO00O0O0000 #line:208
                else :#line:209
                    printc ('正常获得token，但未获得账号信息，','请在法定时间内重新登陆一次','以获得账号信息',conf =[(1 ,36 ,48 ),(1 ,31 ,48 ),(1 ,36 ,48 )])#line:210
                del O0O0OOOOOOOO00OO0 #line:211
        elif O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (_url ,O00OOO00000O00OO0O0 .get ('account_login'))and O00OOO00000OO00O00OO0 ():#line:212
            printc ('account/login包内容:\r\n',flow .response .text ,conf =[(1 ,36 ,48 ),(1 ,33 ,48 )])#line:213
            OO0O00000OO0OOO0O =json .loads (flow .response .content )#line:214
            O00O000OO0000OOOO =[O000OO0OO0O0O0O00 for O000OO0OO0O0O0O00 in data if data [O000OO0OO0O0O0O00 ]['uid']==int (json .loads (flow .request .get_content ())['uid'])]#line:215
            OOO000OO0000OO0OO =O00O000OO0000OOOO [0 ]if len (O00O000OO0000OOOO )>=1 else None #line:216
            del O00O000OO0000OOOO #line:217
            if OOO000OO0000OO0OO :#line:218
                if OO0O00000OO0OOO0O ['result']==0 :#line:219
                    data [OOO000OO0000OO0OO ]['secret']=OO0O00000OO0OOO0O ['secret']#line:220
                    O00O0O0O00000O0O0 =True #line:221
                    printc ('正常获得secret，已保存')#line:222
                else :#line:223
                    printc ('法定时间段内登陆失败，原因未知')#line:224
            else :#line:225
                printc ('查找不到此账号信息，','请在法定时间内登陆一次','以获得账号信息',conf =[(1 ,36 ,48 ),(1 ,31 ,48 ),(1 ,36 ,48 )])#line:226
        elif O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (_url ,O00OOO00000O00OO0O0 .get ('account_sync')):#line:227
            OO0O00000OO0OOO0O =json .loads (flow .response .content )#line:228
            if (OO0O00000OO0OOO0O ['msg']=='stale sequence number'if 'msg'in OO0O00000OO0OOO0O else False ):#line:229
                try :#line:230
                    O00O000OO0000OOOO =[OO0O0OO00O000000O for OO0O0OO00O000000O in data if data [OO0O0OO00O000000O ]['uid']==int (flow .request .headers ['uid'])]#line:231
                    OOO000OO0000OO0OO =O00O000OO0000OOOO [0 ]if len (O00O000OO0000OOOO )>=1 else None #line:232
                    del O00O000OO0000OOOO #line:233
                    if OOO000OO0000OO0OO :#line:234
                        data [OOO000OO0000OO0OO ]['seqnum']=str (int (data [OOO000OO0000OO0OO ]['seqnum'])+2000 )#line:235
                        O00O0O0O00000O0O0 =True #line:236
                        printc ('同步账号信息异常，已经尝试增加seqnum',conf =[(1 ,31 ,48 )])#line:237
                    else :#line:238
                        printc ('查找不到此账号信息，','请在法定时间内登陆一次','以获得账号信息',conf =[(1 ,36 ,48 ),(1 ,31 ,48 ),(1 ,36 ,48 )])#line:239
                except Exception as OOO0OO00O00OOO0O0 :#line:240
                    printc ('同步账号信息异常，尝试增加seqnum失败：',OOO0OO00O00OOO0O0 ,conf =[(1 ,31 ,48 )])#line:241
            elif (OO0O00000OO0OOO0O ['message']=='invalid version'if 'message'in OO0O00000OO0OOO0O else False ):#line:242
                printc ('同步数据时服务器返回invalid version，官服未解决，若是b服可能是上一次登陆信息未保存或者闪断更新导致',conf =[(1 ,31 ,48 )])#line:243
            elif 'msg'in OO0O00000OO0OOO0O or 'message'in OO0O00000OO0OOO0O :#line:244
                printc ('未知错误',conf =[(1 ,31 ,48 )])#line:245
            else :#line:246
                printc ('同步账号信息正常')#line:247
                global char, login_time
                char = OO0O00000OO0OOO0O['user']['troop']['chars']
                login_time = OO0O00000OO0OOO0O['user']['pushFlags']['status']
        elif O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (_url ,O00OOO00000O00OO0O0 .get ('hyper')):#line:248
            printc ('[%s]游戏数据包url: '%O0000O0000Q0000 .strftime ('%H:%M:%S'),_url ,conf =[(1 ,36 ,48 ),(1 ,33 ,48 )])#line:249
            if not 'seqnum'in flow .response .headers :#line:250
                return #line:251
            O00O000OO0000OOOO =[OO00000OO0O0O0000 for OO00000OO0O0O0000 in data if data [OO00000OO0O0O0000 ]['uid']==int (flow .request .headers ['uid'])]#line:252
            OOO000OO0000OO0OO =O00O000OO0000OOOO [0 ]if len (O00O000OO0000OOOO )>=1 else None #line:253
            del O00O000OO0000OOOO #line:254
            if OOO000OO0000OO0OO :#line:255
                if (flow .response .headers ['seqnum']!='null'):#line:256
                    data [OOO000OO0000OO0OO ]['seqnum']=flow .response .headers ['seqnum']#line:257
                    O00O0O0O00000O0O0 =True #line:258
                    printc ('已保存编号: '+str (flow .response .headers ['seqnum']))#line:259
                else :#line:260
                    printc ('未检测到编号，可能是上一次登陆信息未保存或者闪断更新导致',conf =[(1 ,31 ,48 )])#line:261
            else :#line:262
                printc ('查找不到此账号信息，','请在法定时间内登陆一次','以获得账号信息',conf =[(1 ,36 ,48 ),(1 ,31 ,48 ),(1 ,36 ,48 )])#line:263
        if O00O0O0O00000O0O0 :#line:264
            with open (p +'ark_data.json','w',encoding ='utf-8')as OOOO00O00O0OOOOOO :#line:265
                OOOO00O00O0OOOOOO .write (json .dumps (data ,indent =2 ,separators =(', ',': '),ensure_ascii =False ))#line:266
                OOOO00O00O0OOOOOO .close ()#line:267
        '''if O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (_url ,'https://ak-gs-b.hypergryph.com/quest/battleFinish','https://ak-gs-b.hypergryph.com/rlv2/battleFinish'):
            _d = json .loads (flow .request.content )
            battle_decrypt(_d['data'], login_time, char)
        '''
class O00OOO00000OOO00000OO0 :#line:269
    ""#line:285
    def response (OO000OO00O00O0000 ,O0OOOOO0O0O0000O0 :mp .HTTPFlow ):#line:286
        global data #line:287
        O0O0O0O0O0OO0O000 =O0OOOOO0O0O0000O0 .request .url #line:288
        O0OOO00OOO0000OO0 =False #line:289
        if O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (O0O0O0O0O0OO0O000 ,O00OOO00000O00OO0O0 .get ('heartbeat')):#line:290
            O0OO0OOO0O00000OO =json .loads (O0OOOOO0O0O0000O0 .response .content )#line:291
            printc ('heartbeat包内容:\r\n',O0OOOOO0O0O0000O0 .response .text ,conf =[(1 ,36 ,48 ),(1 ,33 ,48 )])#line:292
            if (O0OO0OOO0O00000OO ['data']['user_info']['adult_status']==0 ):#line:293
                O0OO0OOO0O00000OO ['data']['trigger_status']=0 #line:294
                O0OO0OOO0O00000OO ['data']['event_list']=[]#line:295
                O0OOOOO0O0O0000O0 .response .set_text (json .dumps (O0OO0OOO0O00000OO ))#line:296
                printc ('检测到未成年人，已进行返回体修改:\r\n',O0OOOOO0O0O0000O0 .response .text ,conf =[(1 ,36 ,48 ),(1 ,33 ,48 )])#line:297
            else :#line:298
                printc ('检测到已经成年，未进行修改')#line:299
        elif O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (O0O0O0O0O0OO0O000 ,O00OOO00000O00OO0O0 .get ('login_1'),O00OOO00000O00OO0O0 .get ('login_2'),O00OOO00000O00OO0O0 .get ('login_3'),O00OOO00000O00OO0O0 .get ('login_4')):#line:300
            O0OO0OOO0O00000OO =json .loads (O0OOOOO0O0O0000O0 .response .content )#line:301
            printc ('向BililiGame SDK服务器登陆包内容:\r\n',O0OOOOO0O0O0000O0 .response .text ,conf =[(1 ,36 ,48 ),(1 ,33 ,48 )])#line:302
            try:
                _O0 = O0OOOOO0O0O0000O0 .request .urlencoded_form ['access_key']
            except Exception:
                _O0 = ''
            O0O0OO00O0O00O0OO =[a for a in data if data [a]['login']['access_key']==_O0 or (str (data [a ]['login']['uuid'])==O0OOOOO0O0O0000O0 .request .urlencoded_form ['user_id']if 'user_id'in O0OOOOO0O0O0000O0 .request .urlencoded_form else False )]#line:303
            OO0OO000OOO0000O0 =O0O0OO00O0O00O0OO [0 ]if len (O0O0OO00O0O00O0OO )>=1 else None #line:304
            del O0O0OO00O0O00O0OO #line:305
            if O0OO0OOO0O00000OO ['code']!=0 :#line:306
                if OO0OO000OOO0000O0 :#line:307
                    O0OO0OOO0O00000OO ['code']=0 #line:308
                    O0OO0OOO0O00000OO .pop ('message')#line:309
                    O0OO0OOO0O00000OO ['access_key']=data [OO0OO000OOO0000O0 ]['login']['access_key']#line:310
                    O0OO0OOO0O00000OO ['uid']=int (OO0OO000OOO0000O0 )#line:311
                    O0OO0OOO0O00000OO ['face']=data [OO0OO000OOO0000O0 ]['login']['face']#line:312
                    O0OO0OOO0O00000OO ['s_face']=data [OO0OO000OOO0000O0 ]['login']['s_face']#line:313
                    O0OO0OOO0O00000OO ['uname']=data [OO0OO000OOO0000O0 ]['login']['uname']#line:314
                    O0OO0OOO0O00000OO ['expires']=int (O0000O0000Q0000 .time ()+3000000 )#line:315
                    O0OOOOO0O0O0000O0 .response .set_text (json .dumps (O0OO0OOO0O00000OO ))#line:316
                    printc ('检测到登陆code问题，已进行返回体修改:\r\n',O0OOOOO0O0O0000O0 .response .text ,conf =[(1 ,36 ,48 ),(1 ,33 ,48 )])#line:317
                    if not 'uuid'in data [str (O0OO0OOO0O00000OO ['uid'])]['login']or data [str (O0OO0OOO0O00000OO ['uid'])]['login']['uuid']==O0OO0OOO0O00000OO ['uid']or data [str (O0OO0OOO0O00000OO ['uid'])]['login']['uuid']=='':#line:318
                        printc ('检测到此账号登录时的账号、手机号码或邮箱未保存，请自行输入登录时的账号，只有一次机会，注意不要输错：',conf =[(1 ,36 ,41 )])#line:319
                        data [str (O0OO0OOO0O00000OO ['uid'])]['login']['uuid']=str (input ())#line:320
                        O0OOO00OOO0000OO0 =True #line:321
                else :#line:322
                    printc ('查找不到此账号信息，','请在法定时间内登陆一次','以获得账号信息',conf =[(1 ,36 ,48 ),(1 ,31 ,48 ),(1 ,36 ,48 )])#line:323
            else :#line:324
                if OO0OO000OOO0000O0 :#line:325
                    data [OO0OO000OOO0000O0 ]['login']['face']=O0OO0OOO0O00000OO ['face']#line:326
                    data [OO0OO000OOO0000O0 ]['login']['s_face']=O0OO0OOO0O00000OO ['s_face']#line:327
                    data [OO0OO000OOO0000O0 ]['login']['uname']=O0OO0OOO0O00000OO ['uname']#line:328
                    O0OOO00OOO0000OO0 =True #line:329
                    printc ('检测到b服成功登陆，已同步账号信息')#line:330
                    if not 'uuid'in data [str (O0OO0OOO0O00000OO ['uid'])]['login']or data [str (O0OO0OOO0O00000OO ['uid'])]['login']['uuid']==O0OO0OOO0O00000OO ['uid']or data [str (O0OO0OOO0O00000OO ['uid'])]['login']['uuid']=='':#line:331
                        printc ('检测到此账号登录时的账号、手机号码或邮箱未保存，请自行输入登录时的账号，只有一次机会，注意不要输错：',conf =[(1 ,36 ,41 )])#line:332
                        data [str (O0OO0OOO0O00000OO ['uid'])]['login']['uuid']=str (input ())#line:333
                else :#line:334
                    data [str (O0OO0OOO0O00000OO ['uid'])]={'login':{'access_key':O0OO0OOO0O00000OO ['access_key'],'face':O0OO0OOO0O00000OO ['face'],'s_face':O0OO0OOO0O00000OO ['s_face'],'uname':O0OO0OOO0O00000OO ['uname'],'uuid':''},'uid':None ,'seqnum':1 ,'token':None ,'secret':None }#line:347
                    O0OOO00OOO0000OO0 =True #line:348
                    if 'uid' in O0OOOOO0O0O0000O0.request.urlencoded_form:
                        if len (O0OOOOO0O0O0000O0 .request .urlencoded_form ['uid'])>=1 :#line:349
                            data [str (O0OO0OOO0O00000OO ['uid'])]['login']['uuid']=O0OOOOO0O0O0000O0 .request .urlencoded_form ['uid']#line:350
                            printc ('检测到新账号成功登陆，已建立账号信息')#line:351
                            return
                    if not 'uuid'in data [str (O0OO0OOO0O00000OO ['uid'])]['login']or data [str (O0OO0OOO0O00000OO ['uid'])]['login']['uuid']==O0OO0OOO0O00000OO ['uid']or data [str (O0OO0OOO0O00000OO ['uid'])]['login']['uuid']=='':#line:352
                        printc ('检测到此账号登录时的账号、手机号码或邮箱未保存，请自行输入登录时的账号，只有一次机会，注意不要输错：',conf =[(1 ,36 ,41 )])#line:353
                        data [str (O0OO0OOO0O00000OO ['uid'])]['login']['uuid']=str (input ())#line:354
        if O0OOO00OOO0000OO0 :#line:355
            with open (p +'ark_data.json','w',encoding ='utf-8')as O00OO00O0OO0O0O00 :#line:356
                O00OO00O0OO0O0O00 .write (json .dumps (data ,indent =2 ,separators =(', ',': '),ensure_ascii =False ))#line:357
                O00OO00O0OO0O0O00 .close ()#line:358
    '''
    def error(self, flow: mp.HTTPFlow):
        pass
    '''#line:362
class O00OOO00000000O00OOOOOOOO000 :#line:364
    def response (O000O0OO0000O0OOO ,O000O0OO000O000O0 :mp .HTTPFlow ):#line:365
        OO0000O0O0000000O =O000O0OO000O000O0 .request .url #line:366
        if O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (OO0000O0O0000000O ,O00OOO00000O00OO0O0 .get ('gf_login'),O00OOO00000O00OO0O0 .get ('gf_auth')):#line:367
            OOOO00O0000000O0O =json .loads (O000O0OO000O000O0 .response .content )#line:368
            if OOOO00O0000000O0O ['isMinor']==True and T :#line:369
                printc ('进行实名认证')#line:370
                OOOO00O0000000O0O ['isMinor']==True #line:371
                OOOO00O0000000O0O ['isAuthenticate']=False #line:372
                OOOO00O0000000O0O ['needAuthenticate']=True #line:373
                O000O0OO000O000O0 .response .set_text (json .dumps (OOOO00O0000000O0O ))#line:374
        elif O00OOO00000O00OO0O0 .Q00OOO0OOO00000O00OO0 (OO0000O0O0000000O ,O00OOO00000O00OO0O0 .get ('ping')):#line:375
            OOOO00O0000000O0O ={'result':0 ,'message':'OK','interval':5400 ,'timeLeft':-1 ,'alertTime':600 }#line:382
            O000O0OO000O000O0 .response .set_text (json .dumps (OOOO00O0000000O0O ))#line:383
addons =[O00OOO00000OO000OO0 (),O00OOO00000O00OO0000O0O (),O00OOO00000OOO00000OO0 (),O00OOO00000000O00OOOOOOOO000 ()]#line:390
if __name__ =='__main__':#line:392
    from mitmproxy import options #line:393
    from mitmproxy .tools .dump import DumpMaster #line:394
    printc ('请输入数字设置抓包端口（尽量大于1000，必须小于等于65535）：')#line:395
    port =int (input ())#line:396
    opts =options .Options (listen_host ='127.0.0.1',listen_port =port )#line:397
    m =DumpMaster (options =opts )#line:398
    try :#line:399
        printc ('开始抓包，请确保wifi代理地址设置为127.0.0.1，端口为%d，如未下载证书可现在下载'%port )#line:400
        m .addons .add (*addons )#line:401
        m .run ()#line:402
    except :#line:403
        printc ('写入data文件内容:\r\n'+json .dumps (data ,indent =2 ,separators =(', ',': '),ensure_ascii =False ),conf =[(1 ,33 ,48 )])#line:404
        m .shutdown ()